package com.lanqiao.javaparkinglot.controller;

import com.lanqiao.javaparkinglot.common.CommonResult;
import com.lanqiao.javaparkinglot.entity.Driver;
import com.lanqiao.javaparkinglot.entity.Driverhs;
import com.lanqiao.javaparkinglot.service.DriverhsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/driverhs")
public class DriverhsController {
    @Autowired
DriverhsService driverhsService;
    //查询
    @GetMapping("/cha")
    public CommonResult findsjhs(Driver driver){
        List<Driverhs> driverhsList=driverhsService.findsjhs();
        return CommonResult.success("司机核酸表查询",driverhsList);
    }
    //添加
    @PostMapping("/tianjia")
    public CommonResult addsjhs(@RequestBody Driverhs driverhs){
        driverhsService.addsjhs(driverhs);
        return CommonResult.success("司机核酸添加成功");

    }
    //修改
    @PutMapping("/xiugai")
    public CommonResult updatesjhs(@RequestBody Driverhs driverhs){
        driverhsService.updatesjhs(driverhs);
        return CommonResult.success("司机核算信息修改成功");
    }
    //删除
    @DeleteMapping("/{hss_id}")
    public CommonResult deletesjhs(@PathVariable("hss_id") Long hss_id){
        driverhsService.deletesjhs(hss_id);
        return CommonResult.success("数据删除成功");
    }
}
